/*
比赛详情
DetailsOfGame.js*/

import React, {Component,PropTypes} from 'react';
import {connect} from 'dva';
import {routerRedux,withRouter } from 'dva/router';
import { 
	Row,
	Col,
	Button,
	Card,
	Popover,
	Tabs,
	Input,
	DatePicker,
	Collapse,
	List,
	Popconfirm 
} from 'antd';
import moment from 'moment';
import CreateDivision from './CreateDivision';
import AddGameZone from './AddGameZone';
import EditGameZone from './EditGameZone';
import AddEnroll from './AddEnroll';
import DivisionPdtTable from './DivisionPdtTable';
import DepartmentList from './DepartmentList';
import style from './detailOfGame.less';
/*
*DetailsData[比赛详情]
*isEdit[基本信息是否编辑]
*/
const TabPane = Tabs.TabPane;
const Panel = Collapse.Panel;
const RangePicker = DatePicker.RangePicker;
const dateFormat = 'YYYY/MM/DD';


class DetailsOfGame extends Component{
	state={
		"author":'',
	}
	editClick=()=>{
		this.props.dispatch({
			type:'privateGame/setState',
			payload:{
				isEdit:true,
			}
		})
	}

  keepClick=()=>{
  	const {
			marchName,
			beginDate,
			endDate,
			DetailsData,
		} = this.props.privateGame;
		this.props.dispatch({
			type:'privateGame/editfundCompetition',
			payload:{
				name:marchName,
				beginDate:beginDate,
				endDate:endDate,
				id:DetailsData.id
			}
		})
	}
  InputNChange=(e)=>{
		console.log(e.target.value)
		this.props.dispatch({
			type:'privateGame/setState',
			payload:{
				'marchName':e.target.value,
			}
		})
	}
  onChange=(date, dateString)=> {
	  console.log(date, dateString);
	  this.props.dispatch({
			type:'privateGame/setState',
			payload:{
				'beginDate':dateString[0],
				'endDate':dateString[1]
			}
		})
	}
  clickPublish=()=>{
  	const {
			DetailsData,
		} = this.props.privateGame
		this.props.dispatch({
			type:'privateGame/gamePublish',
			payload:{
				id:DetailsData.id
			}
		})
	}
  deleteDivision=(v,d)=>{
		this.props.dispatch({
			type:'privateGame/deleteDivision',
			payload:{
				divisionId:v,
				competitionId:d
			}
		})
	}
  callback=()=>{
		this.props.dispatch({
			type:'privateGame/setState',
			payload:{
				departmentIdList:[],
				departmentList:[],
			}
		})
	}
	componentWillMount() {
		const { login } = this.props;
		const authorities = login.userInfo.authorities;
		if(!_.isEmpty(login.userInfo)){
			login.userInfo.authorities.map((i)=>{
				if(i == 'ROLE_HEADQUARTERSDOCKING' || i=='ROLE_ADMIN'){
					this.setState({
						"author":'0',
					})
				}else if(i == 'ROLE_BRANCHDOCKING'){
					this.setState({
						"author":'2',
					})
				}else{
					this.setState({
						"author":'1',
					})
				}
			})
		}
	}

	render(){
		const {
			marchName,
			beginDate,
			endDate,
			DetailsData,
			isEdit,
			EnrollData,
			departmentData,
			privateData,
		} = this.props.privateGame;
		const {author} =this.state;
		console.log('DetailsOfGame>>',this.props.privateGame,EnrollData,author)
		if(author == '0'&&
			!_.isEmpty(DetailsData)&&DetailsData.status == '草稿'){
			return(
				<div>
					<Card className={style.baseInfo}>
						<Row type="flex" justify="space-between">
							<Col span={18}>
								{/*<h3>基本信息</h3>*/}
								<h3 className={style.rowTitle}>基本信息</h3>
							</Col>
							<Col span={2}>
								<Button type="primary" onClick={this.editClick}>编辑</Button>
							</Col>
							<Col span={2}>
								<Button type="primary" onClick={this.keepClick}>保存</Button>
							</Col>
						</Row>
						{
							isEdit?<Row>
								{/*<label>名称:&nbsp;&nbsp;</label>*/}
								<label className={style.rowText}>名称:&nbsp;&nbsp;</label>
								<Input type="text" style={{width:200}}  value={marchName} onChange={this.InputNChange}/>
							</Row>:<Row>
								{/*<label>名称:&nbsp;&nbsp;</label>*/}
								<label className={style.rowText}>名称:&nbsp;&nbsp;</label>
								<Input type="text" style={{width:200}}  value={DetailsData.name} disabled/>
							</Row>
						}
						{
							isEdit?<Row>
								{/*<label>时间:&nbsp;&nbsp;</label>*/}
								<label className={style.rowText}>时间:&nbsp;&nbsp;</label>
								<RangePicker
									allowClear="false"
									onChange={this.onChange}
									defaultValue={[moment(beginDate || '', dateFormat), moment(endDate || '', dateFormat)]}
								/>
							</Row>:<Row>
								{/*<label>时间:&nbsp;&nbsp;</label>*/}
								<label className={style.rowText}>时间:&nbsp;&nbsp;</label>
								<RangePicker
									allowClear="false"
									value={[moment(DetailsData.beginDate, dateFormat), moment(DetailsData.endDate, dateFormat)]}
									disabled/>
							</Row>
						}
						<Row>
							{/*<label>状态:&nbsp;&nbsp;</label>*/}
							<label className={style.rowText}>状态:&nbsp;&nbsp;</label>
							{/*<span>{DetailsData.status}</span>*/}
							<span className={style.rowText}>{DetailsData.status}</span>
						</Row>
					</Card>
					{
						_.isEmpty(DetailsData.divisionList)?<Card className={style.zone}>
							<Row type="flex" justify="space-between" style={{marginBottom:10}}>
								{/*<h3>赛区</h3>*/}
								<h3 className={style.rowTitle}>赛区</h3>
								<Button type="primary" icon="plus" disabled>新增赛区</Button>
							</Row>
							<Card>
								<CreateDivision
									id={DetailsData.id}
								/>
							</Card>
						</Card>:<Card className={style.zone}>
							<Row type="flex" justify="space-between" style={{marginBottom:10}}>
								{/*<h3>赛区:{DetailsData.numOfDivision}</h3>*/}
								<h3 className={style.rowTitle}>赛区:{DetailsData.numOfDivision}</h3>
								<AddGameZone
									type="新增"
									id={DetailsData.id}
									dispatch={this.props.dispatch}
								/>
							</Row>
							<Collapse className={style.zoneCollapse} accordion onChange={this.callback}>
								{
									DetailsData.divisionList.map((item)=>{
										return (
											<Panel header={item.name} key={item.id}>
												<Row type="flex" justify="end">
													<Col span={3}>
														<Popconfirm title="你确定要删除赛区吗?" okText="确定"  cancelText="取消" onConfirm={()=>this.deleteDivision(item.id,DetailsData.id)}>
															<Button type="primary" >删除</Button>
														</Popconfirm>
													</Col>
													<Col span={3}>
														<EditGameZone
															type="编辑"
															id={item.id}
															competitionId={DetailsData.id}
															departmentList={item.departmentList}
															dispatch={this.props.dispatch}
															zoneName={item.name}
														/>
													</Col>
												</Row>
												<DepartmentList
							         		departmentData={departmentData}
							         		selectData={item.departmentList}
							         	/>
									    </Panel>
										)
									})
								}
						  </Collapse>
						</Card>
					}
					<Card className={style.enrollGame}>
						{
							_.isEmpty(EnrollData)||EnrollData ==undefined?<div>
								<Row type="flex" justify="space-between" align='middle' >
										{/*<h3>报名参赛:</h3>*/}
										<h3 className={style.rowTitle}>报名参赛:</h3>
										{/*<Button type="primary" icon="plus" disabled>报名</Button>*/}
										<Button className={style.enrollBtn} icon="plus" disabled>报名</Button>
								</Row>
								<Row>
									<span>请先设置赛区后，再添加报名</span>
								</Row>
							</div>:<div>
								<Row type="flex" justify="space-between" align='middle'>
									{/*<h3>报名参赛:{EnrollData.length}</h3>*/}
									<h3 className={style.rowTitle}>报名参赛:{EnrollData.length}</h3>
									<AddEnroll 
										privateData={privateData}
										dispatch={this.props.dispatch}
										id={DetailsData.id}
									/>
								</Row>
								<Tabs className={style.tabs}
				          defaultActiveKey="0"
				        >
						   <TabPane  tab={`全部(${EnrollData.length})`} key="0">
		        				<div>
		        					<List
		        						className={style.enrollTotal}
										    itemLayout="horizontal"
										    dataSource={EnrollData}
										    renderItem={item => (
										      <List.Item
										      >
										        <List.Item.Meta
										          title={
										          	<Row>
						          						<span>{item.companyName}</span>&nbsp;&nbsp;
						          						<span>赛区:&nbsp;&nbsp;{item.name}</span>
						          					</Row>
										          }
										          description={
										          	<DivisionPdtTable
										          		competitionId={DetailsData.id}
										          		dispatch={this.props.dispatch}
										          		data={item.products}
										          		departmentData={departmentData}
										          		author={author}
										          	/>
										          }
										        />
										      </List.Item>
										    )}
										  />
		        				</div>
				          </TabPane>
				          {
				          	EnrollData&&!_.isEmpty(EnrollData)?EnrollData.map((item,i)=>{
				          		return(
				          			<TabPane  tab={`${item.name}(${item.products.length})`} key={item.id}>
				          				<List
												    itemLayout="horizontal"
												    className={style.enrollTotal}
												  >
												    <List.Item>
											        <List.Item.Meta
											          title={
											          	<Row>
							          						<span className={style.deleteA}>{item.companyName}</span>&nbsp;&nbsp;
							          						<span>赛区:&nbsp;&nbsp;{item.name}</span>
							          					</Row>
											          }
											          description={
											          	<DivisionPdtTable
											          		competitionId={DetailsData.id}
											          		data={item.products}
											          		dispatch={this.props.dispatch}
											          		departmentData={departmentData}
											          		author={author}
											          	/>
											          }
											        />
											      </List.Item>
												  </List>
				          			</TabPane>
				          		)
				          	}):<span>暂无数据</span>
				          }
				        </Tabs>
							</div>
						}
					</Card>
					{/*<Card style={{marginBottom:30}}>*/}
					<Card className={style.gameFooter} style={{marginBottom:30}}>
						<Row type="flex" justify="end">
							<Col span={3}>
								<Popconfirm title="你确定要发布比赛吗?"  cancelText="取消" onConfirm={this.clickPublish}>
									{
										_.isEmpty(EnrollData)||EnrollData ==undefined?<Button type="primary" disabled>发布</Button>:<Button type="primary" >发布</Button>
									}
								</Popconfirm>
							</Col>
						</Row>
					</Card>
				</div>
			)
		}else if(author == '2'&&
			!_.isEmpty(DetailsData)&&DetailsData.status == '草稿'){
			return(
				<div>
					<Card className={style.baseInfo}>
						<Row type="flex" justify="space-between">
							<Col span={18}>
								{/*<h3>基本信息</h3>*/}
								<h3 className={style.rowTitle}>基本信息</h3>
							</Col>
						</Row>
						{
							isEdit?<Row>
								{/*<label>名称:&nbsp;&nbsp;</label>*/}
								<label className={style.rowText}>名称:&nbsp;&nbsp;</label>
								<Input type="text" style={{width:200}}  value={marchName} onChange={this.InputNChange}/>
							</Row>:<Row>
								{/*<label>名称:&nbsp;&nbsp;</label>*/}
								<label className={style.rowText}>名称:&nbsp;&nbsp;</label>
								<Input type="text" style={{width:200}}  value={DetailsData.name} disabled/>
							</Row>
						}
						{
							isEdit?<Row>
								{/*<label>时间:&nbsp;&nbsp;</label>*/}
								<label className={style.rowText}>时间:&nbsp;&nbsp;</label>
								<RangePicker
									allowClear="false"
									onChange={this.onChange}
									defaultValue={[moment(beginDate || '', dateFormat), moment(endDate || '', dateFormat)]}
								/>
							</Row>:<Row>
								{/*<label>时间:&nbsp;&nbsp;</label>*/}
								<label className={style.rowText}>时间:&nbsp;&nbsp;</label>
								<RangePicker
									allowClear="false"
									value={[moment(DetailsData.beginDate, dateFormat), moment(DetailsData.endDate, dateFormat)]}
									disabled/>
							</Row>
						}
						<Row>
							{/*<label>状态:&nbsp;&nbsp;</label>
							<span>{DetailsData.status}</span>*/}
							<label className={style.rowText}>状态:&nbsp;&nbsp;</label>
							<span className={style.rowText}>{DetailsData.status}</span>
						</Row>
					</Card>
					{
						_.isEmpty(DetailsData.divisionList)?<Card className={style.zone}>
							<Row type="flex" justify="space-between" style={{marginBottom:10}}>
								{/*<h3>赛区</h3>*/}
								<h3 className={style.rowTitle}>赛区</h3>
							</Row>
							<Card>
								<span>暂无赛区</span>
							</Card>
						</Card>:<Card className={style.zone}>
							<Row type="flex" justify="space-between" style={{marginBottom:10}}>
								<h3 className={style.rowTitle}>赛区:{DetailsData.numOfDivision}</h3>
								
							</Row>
							<Collapse className={style.zoneCollapse} accordion onChange={this.callback}>
								{
									DetailsData.divisionList.map((item)=>{
										return (
											<Panel header={item.name} key={item.id}>
												<DepartmentList
							         		departmentData={departmentData}
							         		selectData={item.departmentList}
							         	/>
									     
									    </Panel>
										)
									})
								}
						  </Collapse>
						</Card>
					}
					<Card className={style.enrollGame}>
						{
							_.isEmpty(EnrollData)||EnrollData ==undefined?<div>
								<Row type="flex" justify="space-between" align='middle'>
									{/*<h3 className={style.rowTitle}>报名参赛:</h3>*/}
									<h3>报名参赛:</h3>
									{/*<Button type="primary" icon="plus" disabled>新增</Button>*/}
									<Button className={style.enrollBtn} icon="plus" disabled>新增</Button>
								</Row>
								<Row>
									<span>请先设置赛区后，再添加报名</span>
								</Row>
							</div>:<div>
								<Row type="flex" justify="space-between" align='middle'>
									<h3 className={style.rowTitle}>报名参赛:{EnrollData.length}</h3>
									<AddEnroll 
										privateData={privateData}
										dispatch={this.props.dispatch}
										id={DetailsData.id}
									/>
								</Row>
								<Tabs className={style.tabs}
				          defaultActiveKey="0"
				        >
				          <TabPane  tab={`全部(${EnrollData.length})`} key="0">
		        				<div>
		        					<List
		        						className={style.enrollTotal}
										    itemLayout="horizontal"
										    dataSource={EnrollData}
										    renderItem={item => (
										      <List.Item
										      >
										        <List.Item.Meta
										          title={
										          	<Row>
						          						<span>{item.companyName}</span>&nbsp;&nbsp;
						          						<span>赛区:&nbsp;&nbsp;{item.name}</span>
						          					</Row>
										          }
										          description={
										          	<DivisionPdtTable
										          		competitionId={DetailsData.id}
										          		dispatch={this.props.dispatch}
										          		data={item.products}
										          		departmentData={departmentData}
										          		author={author}
										          	/>
										          }
										        />
										      </List.Item>
										    )}
										  />
		        				</div>
				          </TabPane>
				          {
				          	EnrollData.map((item,i)=>{
				          		return(
				          			<TabPane  tab={`${item.name}(${item.products.length})`} key={item.id}>
				          				<List
												    itemLayout="horizontal"
												    className={style.enrollTotal}
												  >
												    <List.Item>
											        <List.Item.Meta
											          title={
											          	<Row>
							          						<span className={style.deleteA}>{item.companyName}</span>&nbsp;&nbsp;
							          						<span>赛区:&nbsp;&nbsp;{item.name}</span>
							          					</Row>
											          }
											          description={
											          	<DivisionPdtTable
											          		competitionId={DetailsData.id}
											          		data={item.products}
											          		dispatch={this.props.dispatch}
											          		departmentData={departmentData}
											          		author={author}
											          	/>
											          }
											        />
											      </List.Item>
												  </List>
				          			</TabPane>
				          		)
				          	})
				          }
				        </Tabs>
							</div>
						}
					</Card>
					{/*<Card style={{marginBottom:30}}>*/}
					<Card className={style.gameFooter} style={{marginBottom:30}}>
						<Row type="flex" justify="end">
							<Col span={3}>
								<Popconfirm title="你确定要发布比赛吗?"  cancelText="取消" onConfirm={this.clickPublish}>
									<Button type="primary" disabled>发布</Button>
								</Popconfirm>
							</Col>
						</Row>
					</Card>
				</div>
			)
		}else if(author == '1'&&
			!_.isEmpty(DetailsData)&&DetailsData.status == '草稿'){
			return(
				<div>
					<Card className={style.baseInfo}>
						<Row type="flex" justify="space-between">
							<Col span={18}>
								{/*<h3 className={style.rowTitle}>基本信息</h3>*/}
								<h3>基本信息</h3>
							</Col>
						</Row>
						{
							isEdit?<Row>
								<label className={style.rowText}>名称:&nbsp;&nbsp;</label>
								<Input type="text" style={{width:200}}  value={marchName} onChange={this.InputNChange}/>
							</Row>:<Row>
								<label className={style.rowText}>名称:&nbsp;&nbsp;</label>
								<Input type="text" style={{width:200}}  value={DetailsData.name} disabled/>
							</Row>
						}
						{
							isEdit?<Row>
								<label className={style.rowText}>时间:&nbsp;&nbsp;</label>
								<RangePicker
									allowClear="false"
									onChange={this.onChange}
									defaultValue={[moment(beginDate || '', dateFormat), moment(endDate || '', dateFormat)]}
								/>
							</Row>:<Row>
								<label className={style.rowText}>时间:&nbsp;&nbsp;</label>
								<RangePicker
									allowClear="false"
									value={[moment(DetailsData.beginDate, dateFormat), moment(DetailsData.endDate, dateFormat)]}
									disabled/>
							</Row>
						}
						<Row>
							<label className={style.rowText}>状态:&nbsp;&nbsp;</label>
							<span className={style.rowText}>{DetailsData.status}</span>
						</Row>
					</Card>
					{
						_.isEmpty(DetailsData.divisionList)?<Card className={style.zone}>
							<Row type="flex" justify="space-between" style={{marginBottom:10}}>
								{/*<h3 className={style.rowTitle}>赛区</h3>*/}
								<h3>赛区</h3>
							</Row>
							<Card>
								<span>暂无赛区</span>
							</Card>
						</Card>:<Card className={style.zone}>
							<Row type="flex" justify="space-between" style={{marginBottom:10}}>
								<h3 className={style.rowTitle}>赛区:{DetailsData.numOfDivision}</h3>
							</Row>
							<Collapse className={style.zoneCollapse} accordion onChange={this.callback}>
								{
									DetailsData.divisionList.map((item)=>{
										return (
											<Panel header={item.name} key={item.id}>
												<DepartmentList
							         		departmentData={departmentData}
							         		selectData={item.departmentList}
							         	/>
									     
									    </Panel>
										)
									})
								}
						  </Collapse>
						</Card>
					}
					<Card className={style.enrollGame}>
						{
							_.isEmpty(EnrollData)||EnrollData ==undefined?<div>
								<Row type="flex" justify="space-between" align='middle' >
									{/*<h3>报名参赛:</h3>*/}
									<h3 className={style.rowTitle}>报名参赛:</h3>
									{/*<Button type="primary" icon="plus" disabled>报名</Button>*/}
									
								</Row>
								<Row>
									<span>请先设置赛区后，再添加报名</span>
								</Row>
							</div>:<div>
								<Row type="flex" justify="space-between" align='middle'>
									<h3 className={style.rowTitle}>报名参赛:{EnrollData.length}</h3>
									<AddEnroll 
										privateData={privateData}
										dispatch={this.props.dispatch}
										id={DetailsData.id}
									/>
								</Row>
								<Tabs className={style.tabs}
				          defaultActiveKey="0"
				        >
				          <TabPane  tab={`全部(${EnrollData.length})`} key="0">
		        				<div>
		        					<List
		        						className={style.enrollTotal}
										    itemLayout="horizontal"
										    dataSource={EnrollData}
										    renderItem={item => (
										      <List.Item
										      >
										        <List.Item.Meta
										          title={
										          	<Row>
						          						<span>{item.companyName}</span>&nbsp;&nbsp;
						          						<span>赛区:&nbsp;&nbsp;{item.name}</span>
						          					</Row>
										          }
										          description={
										          	<DivisionPdtTable
										          		competitionId={DetailsData.id}
										          		dispatch={this.props.dispatch}
										          		data={item.products}
										          		departmentData={departmentData}
										          		author={author}
										          	/>
										          }
										        />
										      </List.Item>
										    )}
										  />
		        				</div>
				          </TabPane>
				          {
				          	EnrollData.map((item,i)=>{
				          		return(
				          			<TabPane  tab={`${item.name}(${item.products.length})`} key={item.id}>
				          				<List
												    itemLayout="horizontal"
												    className={style.enrollTotal}
												  >
												    <List.Item>
											        <List.Item.Meta
											          title={
											          	<Row>
							          						<span className={style.deleteA}>{item.companyName}</span>&nbsp;&nbsp;
							          						<span>赛区:&nbsp;&nbsp;{item.name}</span>
							          					</Row>
											          }
											          description={
											          	<DivisionPdtTable
											          		competitionId={DetailsData.id}
											          		data={item.products}
											          		dispatch={this.props.dispatch}
											          		departmentData={departmentData}
											          		author={author}
											          	/>
											          }
											        />
											      </List.Item>
												  </List>
				          			</TabPane>
				          		)
				          	})
				          }
				        </Tabs>
							</div>
						}
					</Card>
					{/*<Card style={{marginBottom:30}}>*/}
					<Card className={style.gameFooter} style={{marginBottom:30}}>
						<Row type="flex" justify="end">
							<Col span={3}>
								<Popconfirm title="你确定要发布比赛吗?"  cancelText="取消" onConfirm={this.clickPublish}>
									<Button type="primary" disabled>发布</Button>
								</Popconfirm>
							</Col>
						</Row>
					</Card>
				</div>
			)
		}else if(!_.isEmpty(DetailsData)&&DetailsData.status == '进行中'){
			return(
				<div>
					<Card className={style.baseInfo}>
						<Row type="flex" justify="space-between">
							<Col span={18}>
								{/*<h3>基本信息</h3>*/}
								<h3 className={style.rowTitle}>基本信息</h3>
							</Col>
						</Row>
						{
							isEdit?<Row>
								<label className={style.rowText}>名称:&nbsp;&nbsp;</label>
								<Input type="text" style={{width:200}}  value={marchName} onChange={this.InputNChange}/>
							</Row>:<Row>
								<label className={style.rowText}>名称:&nbsp;&nbsp;</label>
								<Input type="text" style={{width:200}}  value={DetailsData.name} disabled/>
							</Row>
						}
						{
							isEdit?<Row>
								<label className={style.rowText}>时间:&nbsp;&nbsp;</label>
								<RangePicker
									allowClear="false"
									onChange={this.onChange}
									defaultValue={[moment(beginDate || '', dateFormat), moment(endDate || '', dateFormat)]}
								/>
							</Row>:<Row>
								<label className={style.rowText}>时间:&nbsp;&nbsp;</label>
								<RangePicker
									allowClear="false"
									value={[moment(DetailsData.beginDate, dateFormat), moment(DetailsData.endDate, dateFormat)]}
									disabled/>
							</Row>
						}
						<Row>
							<label className={style.rowText}>状态:&nbsp;&nbsp;</label>
							<span className={style.rowText}>{DetailsData.status}</span>
						</Row>
					</Card>
					{
						_.isEmpty(DetailsData.divisionList)?<Card className={style.zone}>
							<Row type="flex" justify="space-between" style={{marginBottom:10}}>
								{/*<h3>赛区</h3>*/}
								<h3 className={style.rowTitle}>赛区</h3>
							</Row>
							<Card>
								<CreateDivision
									id={DetailsData.id}
								/>
							</Card>
						</Card>:<Card className={style.zone}>
							<Row type="flex" justify="space-between" style={{marginBottom:10}}>
								<h3 className={style.rowTitle}>赛区:{DetailsData.numOfDivision}</h3>
								
							</Row>
							<Collapse className={style.zoneCollapse} accordion >
								{
									DetailsData.divisionList.map((item)=>{
										return (
											<Panel header={item.name} key={item.id}>
												<DepartmentList
							         		departmentData={departmentData}
							         		selectData={item.departmentList}
							         	/>
									    </Panel>
										)
									})
								}
						  </Collapse>
						</Card>
					}
					<Card className={style.enrollGame}>
						{
							_.isEmpty(EnrollData)||EnrollData ==undefined?<div>
								<Row type="flex" justify="space-between" align='middle'>
									{/*<h3>报名参赛:</h3>*/}
									<h3 className={style.rowTitle}>报名参赛:</h3>
									{/*<Button type="primary" icon="plus" disabled>新增</Button>*/}
									<Button className={style.enrollBtn} icon="plus" disabled>新增</Button>
								</Row>
								<Row>
									<span>请先设置赛区后，再添加报名</span>
								</Row>
							</div>:<div>
								<Row type="flex" justify="space-between" align='middle'>
									<h3 className={style.rowTitle}>报名参赛:{EnrollData.length}</h3>
									
								</Row>
								<Tabs className={style.tabs}
				          defaultActiveKey="0"
				        >
				          <TabPane  tab={`全部(${EnrollData.length})`} key="0">
		        				<div>
		        					<List
		        						className={style.enrollTotal}
										    itemLayout="horizontal"
										    dataSource={EnrollData}
										    renderItem={item => (
										      <List.Item
										      >
										        <List.Item.Meta
										          title={
										          	<Row>
						          						<span>{item.companyName}</span>&nbsp;&nbsp;
						          						<span>赛区:&nbsp;{item.name}</span>
						          					</Row>
										          }
										          description={
										          	<DivisionPdtTable
										          		data={item.products}
										          		status={DetailsData.status}
										          	/>
										          }
										        />
										      </List.Item>
										    )}
										  />
		        				</div>
				          </TabPane>
				          {
				          	EnrollData.map((item,i)=>{
				          		return(
				          			<TabPane  tab={`${item.name}(${item.products.length})`} key={item.id}>
				          				<List
												    itemLayout="horizontal"
												    className={style.enrollTotal}
												  >
												    <List.Item>
												        <List.Item.Meta
												          title={
												          	<Row>
								          						<span className={style.deleteA}>{item.companyName}</span>&nbsp;&nbsp;
								          						<span>赛区:&nbsp;{item.name}</span>
								          					</Row>
												          }
												          description={
												          	<DivisionPdtTable
												          		data={item.products}
												          		status={DetailsData.status}
												          	/>
												          }
												          
												        />
										      </List.Item>
												  </List>
				          			</TabPane>
				          		)
				          	})
				          }
				        </Tabs>
							</div>
						}
					</Card>
				</div>
			)
		}else if(!_.isEmpty(DetailsData)&&DetailsData.status == '已结束'){
			return(
				<div>
					<Card className={style.baseInfo}>
						<Row type="flex" justify="space-between">
							<Col span={18}>
								{/*<h3>基本信息</h3>*/}
								<h3 className={style.rowTitle}>基本信息</h3>
							</Col>
						</Row>
						{
							isEdit?<Row>
								<label className={style.rowText}>名称:&nbsp;&nbsp;</label>
								<Input type="text" style={{width:200}}  value={marchName} onChange={this.InputNChange}/>
							</Row>:<Row>
								<label className={style.rowText}>名称:&nbsp;&nbsp;</label>
								<Input type="text" style={{width:200}}  value={DetailsData.name} disabled/>
							</Row>
						}
						{
							isEdit?<Row>
								<label className={style.rowText}>时间:&nbsp;&nbsp;</label>
								<RangePicker
									allowClear="false"
									onChange={onChange}
									defaultValue={[moment(beginDate || '', dateFormat), moment(endDate || '', dateFormat)]}
								/>
							</Row>:<Row>
								<label className={style.rowText}>时间:&nbsp;&nbsp;</label>
								<RangePicker
									allowClear="false"
									value={[moment(DetailsData.beginDate, dateFormat), moment(DetailsData.endDate, dateFormat)]}
									disabled/>
							</Row>
						}
						<Row>
							<label className={style.rowText}>状态:&nbsp;&nbsp;</label>
							<span className={style.rowText}>{DetailsData.status}</span>
						</Row>
					</Card>
					{
						_.isEmpty(DetailsData.divisionList)?<Card className={style.zone}>
							<Row type="flex" justify="space-between" style={{marginBottom:10}}>
								{/*<h3>赛区</h3>*/}
								<h3 className={style.rowTitle}>赛区</h3>
							</Row>
							<Card>
								<CreateDivision
									id={DetailsData.id}
								/>
							</Card>
						</Card>:<Card className={style.zone}>
							<Row type="flex" justify="space-between" style={{marginBottom:10}}>
								<h3 className={style.rowTitle}>赛区:{DetailsData.numOfDivision}</h3>
								
							</Row>
							<Collapse className={style.zoneCollapse} accordion >
								{
									DetailsData.divisionList.map((item)=>{
										return (
											<Panel header={item.name} key={item.id}>
												<DepartmentList
							         		departmentData={departmentData}
							         		selectData={item.departmentList}
							         	/>
									    </Panel>
										)
									})
								}
						  </Collapse>
						</Card>
					}
					<Card className={style.enrollGame}>
						{
							_.isEmpty(EnrollData)||EnrollData ==undefined?<div>
								<Row type="flex" justify="space-between" align='middle'>
									{/*<h3>报名参赛:</h3>*/}
									<h3 className={style.rowTitle}>报名参赛:</h3>
									{/*<Button type="primary" icon="plus" disabled>新增</Button>*/}
									<Button className={style.enrollBtn} icon="plus" disabled>新增</Button>
								</Row>
								<Row>
									<span>请先设置赛区后，再添加报名</span>
								</Row>
							</div>:<div>
								<Row type="flex" justify="space-between" align='middle'>
									<h3 className={style.rowTitle}>报名参赛:{EnrollData.length}</h3>
									
								</Row>
								<Tabs className={style.tabs}
				          defaultActiveKey="0"
				        >
				          <TabPane  tab={`全部(${EnrollData.length})`} key="0">
		        				<div>
		        					<List
		        						className={style.enrollTotal}
										    itemLayout="horizontal"
										    dataSource={EnrollData}
										    renderItem={item => (
										      <List.Item
										      >
										        <List.Item.Meta
										          title={
										          	<Row>
						          						<span>{item.companyName}</span>&nbsp;&nbsp;
						          						<span>赛区:&nbsp;{item.name}</span>
						          					</Row>
										          }
										          description={
										          	<DivisionPdtTable
										          		data={item.products}
										          	/>
										          }
										        />
										      </List.Item>
										    )}
										  />
		        				</div>
				          </TabPane>
				          {
				          	EnrollData.map((item,i)=>{
				          		return(
				          			<TabPane  tab={`${item.name}(${item.products.length})`} key={item.id}>
				          				<List
												    itemLayout="horizontal"
												    className={style.enrollTotal}
												  >
												    <List.Item>
												        <List.Item.Meta
												          title={
												          	<Row>
								          						<span className={style.deleteA}>{item.companyName}</span>&nbsp;&nbsp;
								          						<span>赛区:&nbsp;{item.name}</span>
								          					</Row>
												          }
												          description={
												          	<DivisionPdtTable
												          		data={item.products}
												          	/>
												          }
												        />
										      </List.Item>
												  </List>
				          			</TabPane>
				          		)
				          	})
				          }
				        </Tabs>
							</div>
						}
					</Card>
				</div>
			)
		}else{
			return(
				<span>暂无数据</span>
			)
		}
	}
}

export default connect(({privateGame,login})=>({privateGame,login}))(DetailsOfGame)